<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>中英文输出</title>
</head>
<body>
    <input type="text"/>

    <script>
        const inp=document.querySelector('input');
        let isComposite=false;   //是否字符合成
        function search(){
            console.log('搜索:'+inp.value);
        }
        inp.addEventListener('input',function (){
            // console.log('input');
            if (!isComposite){
                search();
            }
        });
        inp.addEventListener('compositionstart',function (){
            isComposite=true;
        });
        inp.addEventListener('compositionend',function (){
            isComposite=false;
            search();   //合成结束再来一次搜索
        });

    </script>
</body>
</html>